
import {
  UserLayout
} from '@/views/layouts'

/**
     * 基础路由
     * @type { *[] }
     */
export default [
  {
    path: '/redirect',
    component: UserLayout,
    hidden: true,
    children: [
      {
        path: '/redirect/:path(.*)',
        component: () => import('@/views/redirect')
      }
    ]
  },
  {
    path: '/user',
    component: UserLayout,
    redirect: '/user/welcome',
    hidden: true,
    children: [
      {
        path: 'login',
        name: 'login',
        component: () => import(/* webpackChunkName: "user" */ '@/views/user/Login')
      },
      {
        path: 'welcome',
        name: 'userWelcome',
        component: () => import('@/views/user/Welcome')
      },
      {
        path: 'helpinstructions',
        name: 'userHelpinstructions',
        component: () => import('@/views/user/HelpInstructions')
      },
      // 问题反馈
      {
        path: '/user/question',
        name: 'userQuestion',
        component: () => import('@/views/user/UserQuestion')
      },
    ]
  },

  {
    path: '/404',
    component: () => import(/* webpackChunkName: "fail" */ '@/views/exception/404')
  },
  {
    path: '/403',
    component: () => import(/* webpackChunkName: "fail" */ '@/views/exception/403')
  },
  {
    path: '/401',
    name: '401',
    redirect: '/user/welcome'
    // component: () => import(/* webpackChunkName: "fail" */ '@/views/exception/401')
  },
  //这个是空白页面，重新加载当前页签会用到    
  {
    name: "blank",
    path: "/blank",
  },
  {
    path: '/404/inner',
    meta: {
      title: '页面找不到'
    },
    component: () => import(/* webpackChunkName: "fail" */ '@/views/exception/404')
  },
  {
    path: '/403/inner',
    meta: {
      title: '无权限'
    },
    component: () => import(/* webpackChunkName: "fail" */ '@/views/exception/403')
  },
  //文件下载页面，以支持先登录再下载
  {
    path: '/file/download',
    component: () => import(/* webpackChunkName: "fail" */ '@/views/fileDownload')
  },
  {
    path: '/sso/callback',
    name:'ssoCallback',
    component: {
      mounted() {
        if (window.top !== window) {
          window.top.ssoSuccessCallBack();
        } else {
          window.location.hash = '/'
        }
      },
      render(h){
        return h(
          'div',
          {
            style: {
              padding: '20px',
              'text-align': 'center',
              'font-size' : '18px'
            },
            domProps: {
              innerHTML: '登录成功'
            },
          }
        )
      }
    }
  },

]
